home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / door / ac174v13.zip / HCHAT.BAS < prev    next >
BASIC Source File  |  1992-10-01  |  10KB  |  310 lines

  1. ' $title: 'ANSIChat Vertical Split Screen Chat for RBBS-PC v17.4x'
  2. '
  3. '          (c) 1991,1992 By Richie Molinelli
  4. '
  5. '
  6. ' $INCLUDE: 'RBBS-VAR.BAS'
  7. '
  8. ' $SUBTITLE: 'ANSIChat - Horizontal Split Screen SysOp ANSI Chat Routine'
  9. '
  10. ' $PAGE
  11. '
  12. '  SUBROUTINE NAME    -  ANSIChat
  13. '
  14. '            INPUT    -  None
  15. '
  16. '           OUTPUT    -  None
  17. '
  18. '  PURPOSE -- Allows Horizontal Split Screen ANSI SysOp Chat for RBBS
  19. '
  20. '
  21. 1000 SUB ANSIChat STATIC               ' Main program
  22.      CALL ClearScrn
  23.      CALL Decorate
  24.      CALL SysopHChat
  25.      CALL ClearScrn
  26.      CALL SkipLine (1)
  27.      END SUB
  28. '
  29. 2000 SUB Decorate STATIC               ' Sets up the screen for chat
  30.      AC1$ = ""               ' Blue
  31.      ScreenTxt$ = STRING$(80,177)
  32.      CALL CurLocate (1,1)
  33.      CALL QuickTPut (AC1$ + ScreenTxt$,0)
  34.      CALL CurLocate (12,1)
  35.      CALL QuickTPut (ScreenTxt$,0)
  36.      CALL CurLocate (1,1)
  37.      CALL QuickTPut (ZEmphasizeOn$ + "ANSIChat v1.3",0)
  38.      OutTxt$ =  " >>> " + ZRBBSName$ + " <<< "
  39.      LocalColumn = 40 - (LEN(OutTxt$)/2)
  40.      CALL CurLocate (1,LocalColumn)
  41.      CALL QuickTPut (OutTxt$,0)
  42.      CALL CurLocate (1,61)
  43.      CALL QuickTPut ("(c) 1992 R Molinelli",0)
  44.      OutTxt$ = " " + ZSysopFirstName$ + " " + ZSysopLastName$
  45.      LocalColumn = (40 - LEN(OutTxt$))/2
  46.      CALL CurLocate (12,LocalColumn)
  47.      CALL QuickTPut (OutTxt$,0)
  48.      OutTxt$ = ZActiveUserName$ + " "
  49.      LocalColumn = 40 + ((40 - LEN(OutTxt$))/2)
  50.      CALL CurLocate (12,LocalColumn)
  51.      CALL QuickTPut (OutTxt$ + ZEmphasizeOff$,0)
  52.      CALL Line25
  53.      CALL CurLocate (2,1)
  54.      END SUB
  55. '
  56. 3000 SUB RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,Bs) STATIC ' Writes Remote Users Input
  57.      IF HoldRTxt$ <> "" AND Bs = 1 THEN _
  58.         HoldRTxt$ = MID$(HoldRTxt$,1,LEN(HoldRTxt$) - 1)
  59.      IF Bs = 1 THEN _
  60.         RemoteColumn = RemoteColumn - 1 : _
  61.         RemoteTxt$ = " " : _
  62.         GOSUB 3010 : _
  63.         Bs = 0 : _
  64.         GOTO 3020
  65.      IF LEN(HoldRTxt$) = 78 THEN
  66.         HoldRTxt$ = ""
  67.         RemoteColumn = 1
  68.         RemoteRow = RemoteRow + 1
  69.         IF RemoteRow > 23 THEN _
  70.            CALL ClearRemoteUpper : _
  71.            RemoteRow = 14
  72.         CALL CurLocate (RemoteRow,RemoteColumn)
  73.      END IF
  74.      IF RemoteTxt$ <> " " THEN _
  75.         HoldRTxt$ = HoldRTxt$ + RemoteTxt$ _
  76.      ELSE _
  77.         HoldRTxt$ = ""
  78.      IF RemoteColumn > 78 AND RemoteTxt$ = " " THEN
  79.         RemoteColumn = 1
  80.         RemoteRow = RemoteRow + 1
  81.         IF RemoteRow = 17 THEN _
  82.            CALL ClearRemoteLower
  83.         IF RemoteRow > 23 THEN _
  84.            CALL ClearRemoteUpper : _
  85.            RemoteRow = 13
  86.         CALL CurLocate (RemoteRow,RemoteColumn)
  87.         RemoteTxt$ = ""
  88.         HoldRTxt$ = ""
  89.         EXIT SUB
  90.      END IF
  91.      IF RemoteColumn > 78 AND RemoteTxt$ <> " " THEN
  92.         RemoteColumn = 79 - LEN(HoldRTxt$)
  93.         CALL CurLocate (RemoteRow,RemoteColumn)
  94.         CALL QuickTPut ("",0)
  95.         RemoteColumn = 1
  96.         RemoteRow = RemoteRow + 1
  97.         IF RemoteRow = 17 THEN _
  98.            CALL ClearRemoteLower
  99.         IF RemoteRow > 23 THEN _
  100.            CALL ClearRemoteUpper : _
  101.            RemoteRow = 13
  102.         CALL CurLocate (RemoteRow,RemoteColumn)
  103.         CALL QuickTPut (ZFG2$ + HoldRTxt$,0)
  104.         RemoteColumn = RemoteColumn + LEN(HoldRTxt$)
  105.         CALL CurLocate (RemoteRow,RemoteColumn)
  106.         ZRemoteTxt$ = ""
  107.         EXIT SUB
  108.      END IF
  109. 3010 CALL CurLocate (RemoteRow,RemoteColumn)
  110.      CALL QuickTPut (ZFG2$ + RemoteTxt$,0)
  111.      IF Bs > 0 THEN _
  112.         CALL CurLocate (RemoteRow,RemoteColumn) : _
  113.         RETURN
  114.      RemoteColumn = RemoteColumn + LEN(RemoteTxt$)
  115. 3020 RemoteTxt$ = ""
  116.      END SUB
  117. '
  118. 4000 SUB LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,Bs) STATIC ' Writes Local Users Input
  119.      IF HoldLTxt$ <> "" AND Bs = 1 THEN _
  120.         HoldLTxT$ = MID$(HoldLTxt$,1,LEN(HoldLTxT$) - 1)
  121.      IF Bs = 1 THEN _
  122.         LocalColumn = LocalColumn - 1 : _
  123.         LocalTxt$ = " " : _
  124.         GOSUB 4010 : _
  125.         Bs = 0 : _
  126.         GOTO 4020
  127.      IF LEN(HoldLTxt$) = 78 THEN
  128.         HoldLTxt$ = ""
  129.         LocalColumn = 1
  130.         LocalRow = LocalRow + 1
  131.         IF LocalRow > 11 THEN _
  132.            CALL ClearLocalUpper : _
  133.            LocalRow = 2
  134.         CALL CurLocate (LocalRow,LocalColumn)
  135.      END IF
  136.      IF LocalTxt$ <> " " THEN _
  137.         HoldLTxt$ = HoldLTxt$ + LocalTxt$ _
  138.      ELSE _
  139.         HoldLTxt$ = ""
  140.      IF LocalColumn > 78 AND LocalTxt$ = " " THEN
  141.         LocalColumn = 1
  142.         LocalRow = LocalRow + 1
  143.         IF LocalRow = 7 THEN _
  144.            CALL ClearLocalLower
  145.         IF LocalRow > 11 THEN _
  146.            CALL ClearLocalUpper : _
  147.            LocalRow = 2
  148.         CALL CurLocate (LocalRow,LocalColumn)
  149.         LocalTxt$ = ""
  150.         HoldLTxt$ = ""
  151.         EXIT SUB
  152.      END IF
  153.      IF LocalColumn > 78 AND LocalTxt$ <> " " THEN
  154.         LocalColumn = 79 - LEN(HoldLTxt$)
  155.         CALL CurLocate (LocalRow,LocalColumn)
  156.         CALL QuickTPut ("",0)
  157.         LocalColumn = 1
  158.         LocalRow = LocalRow + 1
  159.         IF LocalRow = 7 THEN _
  160.            CALL ClearLocalLower
  161.         IF LocalRow > 11 THEN
  162.            CALL ClearLocalUpper
  163.            LocalRow = 2
  164.         END IF
  165.         CALL CurLocate (LocalRow,LocalColumn)
  166.         CALL QuickTPut (ZFG4$ + HoldLTxt$,0)
  167.         LocalColumn = LocalColumn + LEN(HoldLTxt$)
  168.         CALL CurLocate (LocalRow,LocalColumn)
  169.         LocalTxt$ = ""
  170.         EXIT SUB
  171.      END IF
  172. 4010 CALL CurLocate (LocalRow,LocalColumn)
  173.      CALL QuickTPut (ZFG4$ + LocalTxt$,0)
  174.      IF Bs > 0 THEN _
  175.         CALL CurLocate (LocalRow,LocalColumn) : _
  176.         RETURN
  177.      LocalColumn = LocalColumn + LEN(LocalTxt$)
  178. 4020 LocalTxt$ = ""
  179.      END SUB
  180. '
  181.      SUB SysopHChat STATIC             ' Verticl SysOp ANSI Chat routine
  182. 5000 LocalColumn = 1
  183.      LocalRow = 2
  184.      RemoteColumn = 1
  185.      RemoteRow = 13
  186.      RemoteTxt$ = "Hi, " + ZFirstName$ + ".  Go Ahead..."
  187.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  188.      RemoteColumn = 1
  189.      RemoteRow = 14
  190.      HoldLTxt$ = ""
  191.      HoldRTxt$ = ""
  192.      CALL CurLocate (LocalRow,LocalColumn)
  193.      ZWaitExpired = ZFalse
  194. 5010 ZAutoLogoff! = TIMER + ZWaitBeforeDisconnect
  195.      CALL Carrier
  196.      IF ZSubParm < 0 THEN _
  197.         EXIT SUB
  198. 5020 CALL FindFKey
  199.      IF ZWasCM = 0 THEN _
  200.         CALL FlushCom (ZCommPortStack$) : _
  201.         ZKeyPressed$ = "" : _
  202.         ZWasCM = ZTrue : _
  203.         GOTO 5010
  204.      LocalTxt$ = ZKeyPressed$
  205.      IF ZKeyPressed$ = ZEscape$ THEN _
  206.         EXIT SUB
  207.      IF LocalTxt$ = "" THEN _
  208.         GOTO 5030
  209.      IF LocalTxt$ = CHR$(8) THEN _
  210.         GOTO 5070 _
  211.      ELSE IF LocalTxt$ = CHR$(9) THEN _
  212.         GOTO 5090 _
  213.      ELSE IF LocalTxt$ = CHR$(13) THEN _
  214.         GOTO 6010
  215.      CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,0)
  216.      GOTO 5010
  217. 5030 IF ZLocalUser THEN _
  218.         GOTO 5010
  219.      IF ZCommPortStack$ <> "" THEN _
  220.         RemoteTxt$ = LEFT$(ZCommPortStack$,LEN(ZCommPortStack$) - 1) : _
  221.         CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  222.      CALL EofComm (Char)
  223.      IF Char <> -1 THEN _
  224.         GOTO 5050 _
  225.      ELSE _
  226.         GOTO 5010
  227. 5050 ZAutoLogoff! = TIMER + ZWaitBeforeDisconnect
  228.      CALL GetCom (RemoteTxt$)
  229.      IF RemoteTxt$ = CHR$(8) THEN _
  230.         GOTO 6030 _
  231.      ELSE IF RemoteTxt$ = CHR$(9) THEN _
  232.         GOTO 6050 _
  233.      ELSE IF RemoteTxt$ = CHR$(13) THEN _
  234.         GOTO 6070
  235.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  236.      GOTO 5010
  237. 5070 IF LocalColumn - 1 > 0 THEN _     ' Local Back Space
  238.         CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,1)
  239.      GOTO 5010
  240. 5090 IF LocalColumn + 5 > 79 AND LocalRow < 12 THEN _ 'Local TAB
  241.         LocalColumn = 79 _
  242.      ELSE _
  243.         LocalColumn = LocalColumn + 4
  244.      LocalTxt$ = " "
  245.      CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,0)
  246.      GOTO 5010
  247. 6010 LocalColumn = 79                  ' Local Carriage Return
  248.      LocalTxt$ = " "
  249.      CALL LocalScreenWrite (LocalTxt$,LocalRow,LocalColumn,0)
  250.      GOTO 5010
  251. 6030 IF RemoteColumn - 1 > 0 THEN _    ' Remote Back Space
  252.         CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,1)
  253.      GOTO 5010
  254. 6050 IF RemoteColumn + 5 > 79 AND RemoteRow < 24 THEN _  ' Remote TAB
  255.         RemoteColumn = 79 _
  256.      ELSE _
  257.         RemoteColumn = RemoteColumn + 4
  258.      RemoteTxt$ = " "
  259.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  260.      GOTO 5010
  261. 6070 RemoteColumn = 79                 ' Remote Carriage Return
  262.      RemoteTxt$ = " "
  263.      CALL RemoteScreenWrite (RemoteTxt$,RemoteRow,RemoteColumn,0)
  264.      GOTO 5010
  265.      END SUB
  266. '
  267. 7000 SUB ClearScrn STATIC              ' Clears the Entire screen
  268.      CALL QuickTPut ("",0)
  269.      ZSubParm = 2
  270.      CALL Line25
  271.      ZSubParm = 0
  272.      CALL CurLocate (1,1)
  273.      END SUB
  274. '
  275. 7100 SUB ClearRemoteUpper STATIC       ' Clears the Upper half of Remote users screen
  276.      Column = 1
  277.      FOR Row = 13 TO 20
  278.          CALL CurLocate (Row,Column)
  279.          CALL QuickTPut ("",0)
  280.      NEXT Row
  281.      END SUB
  282. '
  283. 7200 SUB ClearLocalUpper STATIC        ' Clears the Upper half of Local users screen
  284.      Column = 1
  285.      FOR Row = 2 TO 8
  286.         CALL CurLocate (Row,Column)
  287.         CALL QuickTPut ("",0)
  288.      NEXT Row
  289.      END SUB
  290. '
  291. 7300 SUB ClearRemoteLower STATIC       ' Clears the lower half of Remote users Screen
  292.      Column = 1
  293.      FOR Row = 21 TO 23
  294.         CALL CurLocate (Row,Column)
  295.         CALL QuickTPut ("",0)
  296.      NEXT Row
  297.      END SUB
  298. '
  299. 7400 SUB ClearLocalLower STATIC        ' Clears the lower half of Local users screen
  300.      Column = 1
  301.      FOR Row = 9 TO 11
  302.         CALL CurLocate (Row,Column)
  303.         CALL QuickTPut ("",0)
  304.      NEXT Row
  305.      END SUB
  306. '
  307. 7500 SUB CurLocate (Row,Column) STATIC ' Moves the cursor to desired position
  308.      CALL QuickTPut ("" + MID$(STR$(Row),2) + ";" + MID$(STR$(Column),2) + "H",0)
  309.      END SUB
  310.